import { http } from '@/utils/request';
import type { User, Type, CodeType, RegisterReslut } from '@/types/user';
// 密码登录
export const postLoginByPasswordAPI = (mobile: string, password: string) =>
  http<User>('/login/password', 'POST', { mobile, password });
// 验证码登录
export const postLoginByLoginAPI = (mobile: string, code: string) =>
  http<User>('/login', 'POST', { mobile, code });
// 获取验证码
export const postLoginByCodeAPI = (mobile: string, type: Type) =>
  http<CodeType>('/code', 'GET', { mobile, type });
// 注册
export const postRegisterAPI = (
  mobile: string,
  code: string,
  password: string
) => http<RegisterReslut>('/register', 'POST', { mobile, code, password });
// qq登录
export const postLoginThirdpartyAPI = (
  openId: string,
  source: string,
  nickname?: string,
  avatar?: string
) =>
  http<User>('/login/thirdparty', 'POST', { openId, source, nickname, avatar });
export const postLoginBindingAPI = (
  mobile: string,
  code: string,
  openId: string
) => http<User>('/login/binding', 'POST', { mobile, code, openId });
